package 剑指Offer1;

import java.util.ArrayList;
import java.util.List;

public class _03从尾到头打印链表 {
    public class ListNode {
       int val;
       ListNode next;
       ListNode(int x) { val = x; }
    }

    private List<Integer> list = new ArrayList<>();
    public int[] reversePrint(ListNode head) {
        traver(head);
        int[] res = new int[list.size()];
        for(int i=0;i<res.length;++i){
            res[i] = list.get(i);
        }
        for (Integer integer : list) {
            
        }
        return res;
    }

    void traver(ListNode head){
        if(head == null) return;
        traver(head.next);
        list.add(head.val);
    }
}
